﻿

using Furion;

namespace tlBasic.Core
{
    public class UserHelper
    {
        public static long GetUserId()
        {
            var value = App.User?.FindFirst(ClaimConst.UserId);
            if ( value==null)
            {
                return 0;
            }
            return long.Parse(value.Value);
        }
        public static string GetUserName()
        {
            var value = App.User?.FindFirst(ClaimConst.Name);
            if (value == null)
            {
                return "";
            }
            return value.Value;
        }
        public static long GetCountyId()
        {
            var value = App.User?.FindFirst(ClaimConst.UserCountyId);
            if (value == null)
            {
                return 0;
            }
            return long.Parse(value.Value);
        }
       
        public static UserType GetUserType()
        {
            var value = App.User?.FindFirst(ClaimConst.UserType);
            if (value == null)
            {
                return 0;
            }
            return (UserType)int.Parse(value.Value);
        }
        public static long GetTokenTime()
        {
            var value = App.User?.FindFirst(ClaimConst.Timestamp);
            if (value == null)
            {
                return 0;
            }
            return  long.Parse(value.Value);
        }
       
    }
}
